<template>
	<view class="person-menu-list">
		 <MenuLayout>
      <mz-list>
        <mz-list-item
          v-for="(item) in btnList"
          :key="item.title"
          :title="item.title"
          :show-arrow="item.showArrow"
          :right-text="item.rightText"
          @click="goto(item)"
        ></mz-list-item>
      </mz-list>
    </MenuLayout> 
	</view>
</template>

<script>
	import EmptyTop from "../../../components/public/EmptyTop/index.vue";
	import MenuLayout from "../../../components/public/MenuLayout/index.vue";
	import {
		mapState,
		mapGetters,
		mapActions
	} from "vuex";
	import manifest from "../../../manifest.json";
	export default {
		components: {
			EmptyTop,
			MenuLayout
		},
		data() {
			return {
				kefuPhone: "15732136855",
				bb: [{
						id: "1",
						title: "我的余额",
						number: "999.00"
					},
					{
						id: "2",
						title: "积分",
						number: "999.00"
					},
					{
						id: "3",
						title: "优惠券",
						number: "666"
					},
				],
			};
		},
		computed: {
			...mapState({
				mainShop: state => state.user.mainShop
			}),
			...mapGetters({
				activeShop: "activeShop"
			}),
			btnList() {
				return [{
						title: "店铺管理",
						url: "shopList",
						showArrow: true
					},
					{
						title: "营业状态",
						url: "shopStatus",
						showArrow: true
					},
					{
						title: "打印机设置",
						url: "printer",
						showArrow: true
					},
					{
						title: "重置密码",
						showArrow: true,
						fun: () => {
							this.$goto("/pages/login/forget", {
								type: "reset"
							});
						}
					},
					// {
					//   title: "联系客服",
					//   url: "",
					//   showArrow: true,
					//   rightText: this.kefuPhone,
					//   fun: () => {
					//     uni.makePhoneCall({
					//       phoneNumber: this.kefuPhone
					//     });
					//   }
					// },
					// {
					//   title: "意见反馈",
					//   url: "feedback",
					//   showArrow: true
					// },
					{
						title: "关于",
						// url: "setting",
						rightText: manifest.versionName,
						showArrow: true
					},
					{
						title: "退出登录",
						url: "",
						showArrow: true,
						fun: () => {
							uni.showModal({
								content: "登出后将不能接单，确认退出登录？",
								success: res => {
									if (res.confirm) {
										this.logout().then(res => {
											uni.reLaunch({
												url: "/pages/login/login"
											});
										});
									}
								}
							});
						}
					}
				];
			}
		},
		methods: {
			...mapActions({
				logout: "logout"
			}),
			goto(item) {
				if (item.url) {
					this.$goto(item.url);
				} else if (item.fun) {
					item.fun();
				}
			},
			
		}
	};
</script>

<style scoped lang="scss">
	.person-menu-list {
		
	}
	
	

</style>